import { Context } from "../class/Context";
import { Debuff } from "../class/Effect";
import { Hurt } from "../class/Hurt";
import { Method } from "../class/Method";
import { Role } from "../class/Role";

export class FengHuangHuoXian extends Method {
    public CD: number = 30E3;
    static methodName: string = "凤凰火线";
    public describe: string = "对敌人造成5S的灼烧伤害，灼烧:每0.5秒对目标敌人造成 100 + 100%(PA) + 2%(HP) 物理伤害。";
    public invoke(context: Context) {
        const itid = context.nextParam();
        const it = this.masterRole.game.getRole(itid);

        it.addEffect(new class extends Debuff {
            // role：Debuff 生效的角色
            // myRole: 释放技能的角色
            constructor(role: Role, protected myRole: Role) {
                super(role);
            }
            public sumTime: number = 5E3;
            public eachTime: number = 5E2;
            public invoke(): void {
                const PA = 100 + this.myRole.getPhysicsAttack() + Math.floor(this.myRole.getHP() * 0.02);
                this.masterRole.onHurt(this.myRole, new Hurt(PA, 0, 0));
            }
        }(it, this.masterRole));
        
    }
}